/*
  File: PermissionMapping.cs
  Author: rcrxy
  CreateTime: 2025/08/07 09:17

  Description:
*/

using AutoMapper;
using StudentVideo.Data.Entities;
using StudentVideo.Shared.Dtos.Permission;

namespace StudentVideo.Mapping;

public class PermissionMapping: Profile {

   public PermissionMapping() {
      CreateMap<PermissionCreateRequest, PermissionEntity>()
         .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.NickName))
         .ForMember(dest => dest.Code, opt => opt.MapFrom(src => src.ApiPath))
         .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Des))
         .ForAllMembers(opt => opt.Condition((src, dest, srcMember) => srcMember != null));
   }
}
